﻿
namespace EasyNet.Solr.Commons.Params
{
    public struct TermsParams
    {
        /// <summary>
        /// The component name.  Set to true to turn on the TermsComponent
        /// </summary>
        public const string TERMS = "terms";

        /// <summary>
        /// Used for building up the other terms
        /// </summary>
        public const string TERMS_PREFIX = TERMS + ".";

        /// <summary>
        /// Required.  Specify the field to look up terms in.
        /// </summary>
        public const string TERMS_FIELD = TERMS_PREFIX + "fl";

        /// <summary>
        /// Optional.  The lower bound term to start at.  The TermEnum will start at the next term after this term in the dictionary.
        /// If not specified, the empty string is used
        /// </summary>
        public const string TERMS_LOWER = TERMS_PREFIX + "lower";

        /// <summary>
        /// Optional.  The term to stop at.
        /// <see cref="#TERMS_UPPER_INCLUSIVE"/>
        /// </summary>
        public const string TERMS_UPPER = TERMS_PREFIX + "upper";

        /// <summary>
        /// Optional.  If true, include the upper bound term in the results.  False by default.
        /// </summary>
        public const string TERMS_UPPER_INCLUSIVE = TERMS_PREFIX + "upper.incl";

        /// <summary>
        /// Optional.  If true, include the lower bound term in the results, otherwise skip to the next one.  True by default.
        /// </summary>
        public const string TERMS_LOWER_INCLUSIVE = TERMS_PREFIX + "lower.incl";

        /// <summary>
        /// Optional.  The number of results to return.  If not specified, looks for {@link org.apache.solr.common.params.CommonParams#ROWS}.  If that's not specified, uses 10.
        /// </summary>
        public const string TERMS_LIMIT = TERMS_PREFIX + "limit";

        public const string TERMS_PREFIX_STR = TERMS_PREFIX + "prefix";

        public const string TERMS_REGEXP_STR = TERMS_PREFIX + "regex";

        public const string TERMS_REGEXP_FLAG = TERMS_REGEXP_STR + ".flag";

        public enum TermsRegexpFlag
        {
            UNIX_LINES,
            CASE_INSENSITIVE,
            COMMENTS,
            MULTILINE,
            LITERAL,
            DOTALL,
            UNICODE_CASE,
            CANON_EQ
        }

        /// <summary>
        /// Optional.  The minimum value of docFreq to be returned.  1 by default
        /// </summary>
        public const string TERMS_MINCOUNT = TERMS_PREFIX + "mincount";

        /// <summary>
        /// Optional.  The maximum value of docFreq to be returned.  -1 by default means no boundary
        /// </summary>
        public const string TERMS_MAXCOUNT = TERMS_PREFIX + "maxcount";

        /// <summary>
        /// Optional.  If true, return the raw characters of the indexed term, regardless of if it is readable.
        /// For instance, the index form of numeric numbers is not human readable.  The default is false.
        /// </summary>
        public const string TERMS_RAW = TERMS_PREFIX + "raw";

        /// <summary>
        /// Optional.  If sorting by frequency is enabled.  Defaults to sorting by count.
        /// </summary>
        public const string TERMS_SORT = TERMS_PREFIX + "sort";

        public const string TERMS_SORT_COUNT = "count";
        public const string TERMS_SORT_INDEX = "index";
    }
}
